package com.ktc.filter;


import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterRegistrationConfig {

    /**
     * 配置跨域访问的过滤器
     * @return
     */
    @Bean
    public FilterRegistrationBean<CrosFilter> registerFilter(){
        FilterRegistrationBean<CrosFilter> bean = new FilterRegistrationBean();
        bean.setFilter(new CrosFilter());
        bean.addUrlPatterns("/*");
        return bean;
    }
}
